import java.util.Scanner;

/**
 * @author: gao
 * @create-date: 2025/3/28 19:03
 */

public class Solution {
    public int singleNumber(int[] nums){
        int ret = 0;
        for (int i = 0; i < 32; i++) {
            int sum = 0;
            for(int x : nums)//依次统计nums中第i位的和
                if(((x >> i) & 1) == 1)
                    sum++;
            sum %= 3;
            if(sum == 1) ret |= 1 << i;
        }
        return ret;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while(in.hasNextInt()){
            int n = in.nextInt();
            int[] nums = new int[n];
            for (int i = 0; i < n; i++) {
                nums[i] = in.nextInt();
            }
            Solution solution = new Solution();
            System.out.println(solution.singleNumber(nums));
        }
    }
}
